/*
 * @Author: whr2349
 * @Date: 2021-07-08 10:41:29
 * @LastEditors: whr2349
 * @LastEditTime: 2021-07-09 08:38:53
 * @Description: file content
 * @FilePath: \back\test\a.js
 */
let a = [{
    name: "wre",
    age: 123
}, {
    name: "whhjkre",
    age: 123
}, {
    name: "wrhje",
    age: 123
}, {
    name: "wjhjre",
    age: 123
}]

let obj = {
    name: "sfsd",
    age: 44,
    [Symbol.iterator]: () => {
        const keys = Object.keys(this);
        let index = 0;
        return {
            next: () => {
                return {
                    value: [keys[index], this[keys[index++]]], // 每次迭代的结果
                    done: index > keys.length // 迭代结束标识 false停止迭代，true继续迭代
                };
            }
        }
    }
}

// let b = a.entries()
// console.log(b)
// for (const key of b) {
//     console.log(key)
// }

// for (const [index, item] of a.entries()) {
//     console.log(index, item)
// }
for (const key in obj) {
    console.log(key);
}